home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / sound / sndplaydoublebuffer / _headers / soundstruct.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  2.5 KB  |  95 lines

  1. /*
  2.     File:        SoundStruct.h
  3.  
  4.     Contains:    Structure that contains all the needed information for playing a sound.
  5.  
  6.     Written by: Mark Cookson    
  7.  
  8.     Copyright:    Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 8/31/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24. #ifndef __SOUNDSTRUCT__
  25. #define __SOUNDSTRUCT__
  26.  
  27. #include <Files.h>
  28. #include <Sound.h>
  29.  
  30. struct sGlobals {
  31.     long        ggestaltSoundAttr,
  32.                 ggestaltStandardFileAttr,
  33.                 ggestaltTranslationAttr;
  34.     Boolean        gSupports16Bit,
  35.                 gSupportsSPDB;
  36. };
  37.  
  38. typedef struct sGlobals sGlobals;
  39. typedef sGlobals *sGlobalsPtr;
  40.  
  41. /*
  42.     This giant structure is in seperate file because it is trying to be
  43.     hidden from view.  In fact there are accessor functions for most values,
  44.     and you should use those accessors.  If you are using DBFF.h a SoundInfoPtr
  45.     is typedef'ed to just a Ptr so that you can't see any of these fields.
  46. */
  47. struct SoundInfo {
  48.     unsigned long            signature;
  49.     Str63                    theName;
  50.     SndDoubleBufferHeader2    doubleHeader;
  51.     SndChannelPtr            chan;
  52.     SndCallBackUPP            theSoundCallBackUPP;
  53.     sGlobals                globals;
  54.     Fixed                    rateForResume;
  55.     unsigned long            fileType;
  56.     long                    numBuffers,
  57.                             dataStart,
  58.                             bytesTotal,
  59.                             bytesCopied,
  60.                             currentBuffer,
  61.                             doubleBufferSize;
  62.     short                    bytesPerFrame,
  63.                             refNum,
  64.                             vRefNum,
  65.                             compFactor;
  66.     Boolean                    paused,
  67.                             playing,
  68.                             adjusting,
  69.                             soundDone,
  70.                             backwards,
  71.                             hasBeenAdjusted,
  72.                             needsMasking,
  73.                             stopping;
  74. };
  75.  
  76. typedef struct SoundInfo SoundInfo;
  77. typedef SoundInfo *SoundInfoPtr;
  78.  
  79. /*
  80.     This is used to carry useful information to our interrupt routines.
  81.     I wouldn't remove any fields from this structure.
  82. */
  83. struct myParamBlockRec {
  84.     ParamBlockRec            pb;
  85.     long                    myA5;
  86.     SndDoubleBufferPtr        theBuffer;
  87.     SoundInfoPtr            theSoundInfo;
  88.     Boolean                    pbInUse;
  89. };
  90.  
  91. typedef struct myParamBlockRec myParamBlockRec;
  92. typedef myParamBlockRec *myParmBlkPtr;
  93.  
  94. #endif
  95.